@extends('admin.layout')

@section('content')
    <div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
        <form action="{{route('admin.role.assignPermission',$role)}}" method="post" class="layui-form">
            <div id="tree"></div>
            <div class="layui-form-item layui-hide">
                <input type="button" lay-submit lay-filter="submit" id="submit" value="确认">
            </div>
        </form>
    </div>
@endsection

@section('js')
    <script>
        layui.use(['index', 'tree'], function(){
            var tree = layui.tree
                ,layer = layui.layer;

            //基本演示
            tree.render({
                elem: '#tree'
                ,data: @json($permissions)
                ,showCheckbox: true  //是否显示复选框
                ,id: 'tree_id'
                ,isJump: true //是否允许点击节点时弹出新窗口跳转
                ,click: function(obj){
                    //var data = obj.data;  //获取当前点击的节点数据
                    //layer.msg('状态：'+ obj.state + '<br>节点数据：' + JSON.stringify(data));
                }
            });
        });
    </script>
@endsection
